<?php

namespace app\api\validate;

use think\Validate;

class Address extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name' => 'require',
        'phone' => 'require|max:11|/^1[3-8]{1}[0-9]{9}$/',
        'city' => 'require',
        'address' => 'require',

    ];
    /**
     * 提示消息
     */
    protected $message = [
        'name.require' => '请输入收货人姓名！',
        'phone.require' => '请输入手机号！',
        'phone.max' => '手机号码不能超过11位！',
        'phone./^1[3-8]{1}[0-9]{9}$/' => '手机号码格式不正确！',
        'city.require' => '请选择省市区！',
        'address.require' => '请输入详情地址！',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['name','phone','city','address'],
        'edit'  => ['name','phone','city','address'],
    ];
    
}
